package com.dyh.quickdemo.demos.EnhanceFc;

import java.util.List;
import java.util.function.Function;

/*
@Author=Joey Wheeler
@Date=2020/10/26 14:18
*/
public class InspFunc<T,R> extends BaseFunc<T,R>{

    List<Function<T,R>> interceptors;

    @Override
    public R apply(T t) {
        R r = null;
        for (Function<T, R> interceptor : interceptors) {
            r = interceptor.apply(t);
            if (r!=null)//拦截到
                return r;
        }
        r = core.apply(t);
        return r;
    }
}
